package com.huiminpay.transaction.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huiminpay.transaction.dto.PayChannelDTO;
import com.huiminpay.transaction.entity.PayChannel;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author author
 * @since 2019-11-15
 */
@Repository
public interface PayChannelMapper extends BaseMapper<PayChannel> {

    /**
     * 根据服务类型code查询对应的支付渠道
     * @param platformChannelCode 服务类型编码
     * @return
     */

    @Select(   "SELECT pc.* " +
           " FROM pay_channel pc" +
            " INNER JOIN platform_pay_channel ppc ON pc.CHANNEL_CODE=ppc.PAY_CHANNEL" +
            " INNER JOIN platform_channel pcl ON ppc.PLATFORM_CHANNEL = pcl.CHANNEL_CODE" +
            " WHERE pcl.CHANNEL_CODE = #{platformChannelCode}")
    List<PayChannelDTO> selectPayChannelByPlatformChannel(String platformChannelCode);
}
